<extend name="Application/Admin/View/Layout/application.html" />

<block name="content">


            <div class="row">
                <div class="col-md-10">
                    <div class="panel panel-default">
                        <div class="panel-heading">栏目管理</div>

                        <div class="panel-body">
                            <form action="" method="post" id="form">
                                <table class="table table-hover">
                                    <thead >
                                    <tr>
                                        <th class="col-sm-1">排序</th>
                                        <th>名称</th>
                                        <th>栏目文章</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>


                                    <volist name="categories" id="category">

                                        <tr>
                                            <th scope="row" class="col-sm-1">
                                                <input type="hidden" name="ids[]" value="{{$category.id}}">
                                                <input type="text"  name="sort_order[]" value="{{$category.sort_order}}">
                                            </th>
                                            <td class="name" class="col-sm-1">{{$category.name}}</td>


                                        </tr>


                                            <volist name="category['children']" id="c">
                                                <tr>
                                                    <th scope="row" class="col-sm-1">
                                                        <input type="hidden" name="ids[]" value="{{$category.id}}">
                                                        <input type="text"  name="sort_order[]" value="{{$category.sort_order}}">
                                                    </th>
                                                    <th>
                                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{$c.name}}
                                                    </th>
                                                    <td>
                                                        栏目文章
                                                    </td>
                                                    <td>
                                                        <a href="{{:U('add')}}">
                                                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                                                        </a>
                                                        <a href="{{:U('edit',array('id'=>$c['id']))}}">
                                                            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                                                        </a>
                                                        <a href="{{:U('destroy',array('id'=>$c['id']))}}">
                                                            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
                                                        </a>
                                                    </td>
                                                </tr>

                                            </volist>

                                    </volist>


                                    </tbody>
                                </table>
                            </form>


                        </div>
                    </div>
                </div>

                <div class="col-md-2">
                    <div class="list-group">
                        <a href="{{:U('add')}}" class="list-group-item list-group-item-info create_link">
                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 新增 (add)
                        </a>



                        <a href="javascript: void 0;" class="list-group-item list-group-item-info sort_link">
                            <span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> 排序 (sort)
                        </a>
                    </div>
                </div>
            </div>

</block>




<block name="js">
    <script>
        $(function () {
            $(".sort_link").click(function(){
                $("#form").attr("action","{{:U('sort_link')}}").submit();

            })
        })

    </script>

</block>